Case when usage, simple Case FunctionUse a simple CASE expression to determine the return value.
Syntax:
CASE search_expression
WHEN expression1 THEN result1
WHEN expression2 THEN result2
...
WHEN expressionN THEN resultN
ELSE default_result
Search
Use of case, simple case functionA simple case expression that uses an expression to determine the return value.
Grammar:
Case Search_expression
When Expression1 THEN RESULT1
When Expression2 THEN result2
...
When Expressionn THEN Resultn
Use of case, simple case functionA simple case expression that uses an expression to determine the return value.
Grammar:
Case Search_expression
When Expression1 THEN RESULT1
When Expression2 THEN result2
...
When Expressionn THEN Resultn
ELSE
The use of case when (turn)--Simple Case functionA simple case expression that uses an expression to determine the return value.
Grammar:
The code is as follows
Copy Code
Case Search_expressionWhen Expression1 THEN
We all know the usage of case when. Once a certain when is satisfied, the data will exit the case when instead of considering other cases,ArticleTo introduce the usage of case when in detail and give an example. Case when usage-simple case function
The use of case--simple case function simple case expression, using an expression to determine the return value. Syntax: Case search_expression while expression1 then RESULT1 when expression2 Then result2 ... When Expressionn then Resultn ELSE
We all know when the use of the case, once satisfied with a certain when, then this data will be withdrawn when, and no longer consider other case, the article detailed introduction of the case when the use and examples to explain. Case
In front of you to explain a multi-choice ElseIf statement, although this statement can make a variety of judgments, but when used, need to write a lot of if statements, to our program readability inconvenience, in order to avoid the IF statement
Switch statements in PHP are used to perform different actions based on multiple different conditions. If you want to selectively execute one of several blocks of code, use a Switch statement.
Switch syntax
The code is as follows
In php, if else or switch statements are used most frequently, next, I will give you a detailed introduction to my notes on using the if else Conditional Control statement in php. if you need it, please refer to it.
In php, the basic process control
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.